// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import 'lib-flexible'
import axios from 'axios'
Vue.prototype.axios = axios
import './assets/css/style.css'
import './assets/css/font-awesome.css'

router.beforeEach((to, from, next) => {
    if (to.path === '/home') {
        next({ path: "/home/All" })
    } else {
        next()
    }

})

Vue.filter('number',value => {
  var time = new Date(value)
  var times = new Date()
  var timer = times - time
  if(timer/2592000000 > 1){
        return (value = Math.ceil(timer/2592000000) + '个月前')
    }
    else if(timer/86400000 > 1){
        return (value = Math.ceil(timer/86400000) + '天前')
    }
    else if(timer/3600000 > 1){
        return (value = Math.ceil(timer/3600000) + '小时前')
    }
    else if(timer/3600000 < 1){
        return ('刚刚')
    }
})


new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})


